﻿DECLARE @Var_FirstDeptCode VARCHAR(20)
SET @Var_FirstDeptCode = (@FirstDeptCode_In)

SELECT  RTRIM(b.LBCODE) AS LBCode
       ,RTRIM(b.LBName) AS LBName
       ,'' AS Description
FROM dbo.MZSchedule a(NOLOCK) JOIN dbo.KSCODE b(NOLOCK) ON a.KSCode = b.CODE
WHERE 
Weekday = DATEPART(WEEKDAY,GETDATE())
AND LBCode LIKE @Var_FirstDeptCode
AND (STATUS IS NULL OR STATUS = 2)
GROUP BY RTRIM(b.LBCODE),RTRIM(b.LBName)